<?php

namespace app\common\model;

//use think\Model;

class RechargeModel extends BaseModel{

	protected $table = 'tp_recharge_record';

	/*
	添加记录
	 */
	public function addData($uid,$cid,$amount,$order,$cert){
		$res = $this->insert([
			'uid'=>$uid,
			'cid'=>$cid,
			'amount'=>$amount,
			'order'=>$order,
			'cert'=>$cert,
			'remark'=>'待审核',
			'status'=>0,
			'date'=>$this->getTime()
		]);
		return $res;
	}

	/*
	获取记录
	 */
	public function getRecord($uid){
		$data = $this->alias('r')
					->join('tp_coin c','c.id=r.cid','LEFT')
					->where('r.uid',$uid)
					->field('r.*,c.name coin_name')
					->order('r.id desc')
					->select();
		return $data;
	}
}